// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程：https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
const baseUrl = 'https://183.234.22.244:8090/k3cloud'
module.exports = {
  _before: function () {
    // 通用预处理器
  },
  async sendRequest(data) {
    const res = await uniCloud.httpclient.request(
      data.url
       ,
      {
		headers:data.headers || '',
        method: data.method || 'GET',
  		data:data.data || {},
        dataType:data.dataType ||  "json",
        contentType: data.contentType ||  "json",

        rejectUnauthorized: false,
		timeout:30000
      }
    );
    // 返回结果
    return {
      data: res.data,
    };
  },
  /**
   * 获取账套信息
   */
  async GetServerCommonConfig(data) {
    const res = await uniCloud.httpclient.request(
      data.url
       ,
      {
        method: "GET",
		data:data.data || {},
        dataType: "json",
        contentType: "json",
        rejectUnauthorized: false,
      }
    );
    // 返回结果
    return {
      data: res.data,
    };
  },
  /**
   * @param {Object} data 登录数据
   */
  async login(data) {
    const res = await uniCloud.httpclient.request(
     data.url,
      {
        method: "POST",
        data:data.data || {},
        dataType: "json",
        contentType: "json",
        rejectUnauthorized: false,
      }
    );
    // 返回结果
    return {
      data: res.data,
    };
  },
};
